
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Caches &#8212; Freedom Metal v201905 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Clocks" href="clock.html" />
    <link rel="prev" title="Buttons" href="button.html" />
   
  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="caches">
<h1>Caches<a class="headerlink" href="#caches" title="Permalink to this headline">¶</a></h1>
<p>API for configuring caches. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric">Functions</p>
<dl class="function">
<dt id="_CPPv316metal_cache_initP11metal_cachei">
<span id="_CPPv216metal_cache_initP11metal_cachei"></span><span id="metal_cache_init__metal_cacheP.i"></span><span class="target" id="cache_8h_1a7a302291f2168c036f92cf72f44ba89d"></span>void <code class="descname">metal_cache_init</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv311metal_cache" title="metal_cache">metal_cache</a> *<em>cache</em>, int <em>ways</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv316metal_cache_initP11metal_cachei" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Initialize a cache. </p>
<p><p>Initializes a cache with the requested number of ways enabled. </p>
<dl class="docutils">
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">cache</span></code>: The handle for the cache to initialize </li>
<li><code class="docutils literal notranslate"><span class="pre">ways</span></code>: The number of ways to enable</li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv328metal_cache_get_enabled_waysP11metal_cache">
<span id="_CPPv228metal_cache_get_enabled_waysP11metal_cache"></span><span id="metal_cache_get_enabled_ways__metal_cacheP"></span><span class="target" id="cache_8h_1a4533d6c4cbe55f440d28c28b9adfea80"></span>int <code class="descname">metal_cache_get_enabled_ways</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv311metal_cache" title="metal_cache">metal_cache</a> *<em>cache</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv328metal_cache_get_enabled_waysP11metal_cache" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Get the current number of enabled cache ways. </p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>The current number of enabled cache ways </dd>
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">cache</span></code>: The handle for the cache </li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv328metal_cache_set_enabled_waysP11metal_cachei">
<span id="_CPPv228metal_cache_set_enabled_waysP11metal_cachei"></span><span id="metal_cache_set_enabled_ways__metal_cacheP.i"></span><span class="target" id="cache_8h_1aef6fe740ef5b57b0784e0e19e3219a8e"></span>int <code class="descname">metal_cache_set_enabled_ways</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv311metal_cache" title="metal_cache">metal_cache</a> *<em>cache</em>, int <em>ways</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv328metal_cache_set_enabled_waysP11metal_cachei" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Enable the requested number of cache ways. </p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>0 if the ways are successfully enabled </dd>
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">cache</span></code>: The handle for the cache </li>
<li><code class="docutils literal notranslate"><span class="pre">ways</span></code>: The number of ways to enabled </li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

</div>
<dl class="class">
<dt id="_CPPv311metal_cache">
<span id="_CPPv211metal_cache"></span><span id="metal_cache"></span><span class="target" id="structmetal__cache"></span><em class="property">struct </em><code class="descname">metal_cache</code><a class="headerlink" href="#_CPPv311metal_cache" title="Permalink to this definition">¶</a><br /></dt>
<dd><em>#include &lt;cache.h&gt;</em><p>a handle for a cache </p>
</dd></dl>

</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">Freedom Metal</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction to Freedom Metal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devguide.html">Developer Guide</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">API Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="button.html">Buttons</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Caches</a></li>
<li class="toctree-l2"><a class="reference internal" href="clock.html">Clocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpu.html">CPU</a></li>
<li class="toctree-l2"><a class="reference internal" href="gpio.html">GPIO</a></li>
<li class="toctree-l2"><a class="reference internal" href="interrupt.html">Interrupts</a></li>
<li class="toctree-l2"><a class="reference internal" href="itim.html">ITIM</a></li>
<li class="toctree-l2"><a class="reference internal" href="led.html">LEDs</a></li>
<li class="toctree-l2"><a class="reference internal" href="lock.html">Locks</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html">Memory Enumeration</a></li>
<li class="toctree-l2"><a class="reference internal" href="pmp.html">PMPs</a></li>
<li class="toctree-l2"><a class="reference internal" href="shutdown.html">Shutdown</a></li>
<li class="toctree-l2"><a class="reference internal" href="spi.html">SPIs</a></li>
<li class="toctree-l2"><a class="reference internal" href="switch.html">Switches</a></li>
<li class="toctree-l2"><a class="reference internal" href="timer.html">Timer API</a></li>
<li class="toctree-l2"><a class="reference internal" href="tty.html">TTY</a></li>
<li class="toctree-l2"><a class="reference internal" href="uart.html">UARTs</a></li>
</ul>
</li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../index.html">Documentation overview</a><ul>
  <li><a href="../api.html">API Reference</a><ul>
      <li>Previous: <a href="button.html" title="previous chapter">Buttons</a></li>
      <li>Next: <a href="clock.html" title="next chapter">Clocks</a></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2019, SiFive Inc..
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
      
      |
      <a href="../_sources/apiref/cache.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>